home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d26 / process1.arc / PROCESS1.DOC < prev    next >
Text File  |  1991-06-08  |  8KB  |  192 lines

  1.                             PROCESS1
  2.  
  3.          A Process Control Simulation of a Gravity Tank
  4.          ==============================================
  5.  
  6.      I am a chemical engineer major at the University of Wyoming. 
  7. Last semester I took a process control class that really blew me
  8. away.  Even though I got a B in the class I was not satisfied
  9. with my understanding of the subject.  So this Summer I hope to
  10. write several programs to help me understand various processes. 
  11. This documentation will explain some of the theory behind the
  12. program.  Hopefully, as I try to explain to you the principals
  13. guiding the various processes, I will learn something myself.
  14.  
  15.      I am taking Summer courses and working full time.  I am also
  16. a brand new C++ programmer (this is my second program).  I am a
  17. little slow at programming right now because 1) it is a new
  18. language for me and 2) I have not programmed for four years. 
  19. Because of this I may not get as many programs out as I hope.
  20.  
  21.  
  22.                       A Gravity Flow Tank.
  23.  
  24. A gravity flow tank is diagramed below:
  25.  
  26.                      
  27.                   ■                  ■
  28.             ■═════╝                  ║
  29.        Fo ->                         ║
  30.             ■═════╗                  ║
  31.                   ║                  ║
  32.                   ║                  ║
  33.                   ║                  ║
  34.                   ╟──────────────────╢ 
  35.                   ║    ^             ║
  36.                   ║    |             ║
  37.                   ║    |             ║
  38.                   ║    |             ║
  39.                   ║    |             ║
  40.                   ║    h             ║
  41.                   ║    |             ║
  42.                   ║    |             ║
  43.                   ║    |             ║
  44.                   ║    |             ║         L
  45.                   ║    |             ╚══════════════════════■
  46.                   ║    |  At        Ap                       F ->
  47.                   ╚═════════════════════════════════════════■
  48.  
  49.      Fo is the flow into the tank, h is the height of the fluid,
  50. At is the area of the tank, Ap is the cross sectional area of the
  51. pipe, L is the length of the pipe, and F is the flow out of the
  52. pipe. The density is assumed to be constant for the
  53. incompressible liquid.
  54.  
  55.      The mass in the pipe will be assumed to be constant
  56. throughout the procedures:
  57.  
  58. M=(Ap)*L*(fluid_density)
  59.  
  60.      The velocity of the fluid in the pipe is assumed to be the
  61. same at every point in the pipe:
  62.  
  63. velocity*(Ap)=F
  64.  
  65.      In order to change the velocity forces must be applied. 
  66. There are two important sources of forces in this set up:
  67.  
  68.      1) The hydraulic force that the fluid in the tank exerts on
  69.         the column of fluid in the pipe:
  70.  
  71.               (Hf)=(Ap)*(fluid_density)*h*[g/(gc)]
  72.  
  73.         [g/(gc) is a conversion factor that changes pounds mass
  74.         into pounds force.  g=the acceleration of gravity=32.2
  75.         ft/s^2. (gc)=32.2 lb(mass) *ft/lb(force)/s^2.]
  76.  
  77.      2) The frictional force of the fluid against the pipe:
  78.  
  79.                           (Ff)=K*L*v^2
  80.  
  81.         (K is a friction constant)
  82.  
  83.      Force is equal to mass times acceleration. acceleration can
  84. be represented as a small change in velocity over a small length
  85. of time:
  86.  
  87.                         Force=Ma=M(dv/dt)
  88.  
  89.      The net force in any direction is the sum of all the forces
  90. acting in that direction.  Here we are dealing with the forces on
  91. the column of fluid in the pipe.  The (gc) conversion for pounds
  92. mass to pounds force is also included:
  93.  
  94.                  M/(gc)*dv/dt=ΣForces=(Hf)-(Ff)
  95.  
  96.      By substituting and simplification we get the following
  97. equation for the small changes in velocity:
  98.  
  99.            dv/dt=g*h/L-K*(gc)*v^2/[(Ap)*fluid_density]
  100.  
  101.      The height of the fluid on the tank is dependant on the
  102. volume of the tank at any given time.  Small changes in the
  103. volume are dependant on the difference of the flows into and out
  104. of the tank.  Since the area of the tank is constant it is
  105. possible to find small changes in height in relation to the
  106. difference of the flows:
  107.  
  108.                      dV/dt=(At)*(dh/dt)=Fo-F
  109.  
  110.      Now we have everything we need to predict small changes in
  111. height and velocity in the system.  F is simply v*(Ap).  In the
  112. program output this equation is used to define F.  I think it is
  113. easier to think of this situation in terms of flow and height.
  114.  
  115.      Since our small changes are in terms of derivatives, we must
  116. have a way of estimating them.  The method used here is called
  117. linearization.  The estimate change is calculated by assuming
  118. that small steps in a linear fashion can represent a non linear
  119. function.  This linearization is represented below:
  120.  
  121.               F(next)=F(now)+[dF(now)/dt]*(delta t)
  122.  
  123.      This simply states that the following value of the function
  124. is approximately the present value of the function plus a small
  125. change related to whether the function is increasing or
  126. decreasing with time.  Delta t is the small increment of time
  127. being considered.  It is usually a small value.
  128.  
  129.      He heart of the calculations are based on this linearization
  130. method:
  131.  
  132. height=h+(dh/dt)*(delta t)
  133.                                and
  134.                   velocity=v+(dv/dt)*(delta t)
  135.  
  136.      The simulation is made to help you see what happens when
  137. there is a sudden increase or decrease in the Flow into the tank. 
  138. The tank starts out at a steady state at the beginning of each
  139. run.  Steady state is where Fo and F are the same and there are
  140. no changes in the system.  You are allowed to choose values for
  141. the steady state and new flow values.  At time zero the flow
  142. suddenly increases from the steady state to the new flow value. 
  143. This is known as a "step."
  144.  
  145.      Viewing the data on a screen is not always that helpful.  I
  146. have provided two ways to help you study your data better.  After
  147. you have run your experiment the program will give you the option
  148. of printing a table or graph.
  149.  
  150.      The table prints all the flow and height values that
  151. appeared on the screen.  The graph option prints out a low
  152. resolution graph, but you can see visibly how the height changes
  153. during the adjustment from the steady state to the new flow
  154. value.
  155.  
  156.      The experiment ends itself in one of two ways.  If the
  157. values of flow and height have stayed the same (three decimal
  158. places) for 60 delta times, the system is assumed to have reached
  159. a new steady state value.  The program will always stop at 4000
  160. delta times.  The system may either be slow to reach a new steady
  161. state or will never reach steady state.
  162.  
  163.      Go ahead and experiment with different values.
  164.  
  165.      Since the program is free, there is no warranty or
  166. guaranties (what could I promise anyway?).  You can have, use,
  167. copy, and give the program to others.  However, the following
  168. regulations must be observed:
  169.  
  170.      1) The disk (or compressearchive) containing the program
  171.         must include all the following files in UNMODIFIED form:
  172.           PROCESS1.EXE
  173.           PROCESS1.DOC
  174.           PROCESS1.DSC
  175.           NOREADME.DOC
  176.           PROGRAM .DOC
  177.  
  178.      2) No more than $5 may be charged for copying services.
  179.  
  180.      The source code is available for $5 at the address given at
  181. the end of this document.  I retain the rights to this program
  182. and its source code.  Modified versions may not be distributed
  183. without my written consent.
  184.      If you have any questions, comments, ideas, etc., just drop
  185. me a line.  I would like to know where this program is getting
  186. around to.
  187.  
  188. BASHER@corral.uwyo.edu
  189.  
  190. Address:
  191. 623 Lewis #B
  192. Laramie, WY 82070